﻿using System;
using System.Web.Hosting;

using Flagwind.Plugins;

namespace Flagwind.Web.Plugins.Hosting
{
	public class PluginVirtualPathProvider : VirtualPathProvider
	{
		#region 成员字段

		private PluginContext _pluginContext;

		#endregion

		#region 构造方法

		public PluginVirtualPathProvider(PluginContext pluginContext)
		{
			if(pluginContext == null)
				throw new ArgumentNullException(nameof(pluginContext));

			_pluginContext = pluginContext;
		}

		#endregion

		public override bool FileExists(string virtualPath)
		{
			var exists = base.FileExists(virtualPath);
			return exists;
		}

		public override VirtualDirectory GetDirectory(string virtualDir)
		{
			return base.GetDirectory(virtualDir);
		}

		public override VirtualFile GetFile(string virtualPath)
		{
			if(string.IsNullOrWhiteSpace(virtualPath))
				return null;

			return base.GetFile(virtualPath);
		}
	}
}
